Cognizance of offence by magistrate and court of session